package cn.bisoft.java.util.test;

public class PerformanceUtil
{
	/** 存储性能统计开始时间 */
	private static ThreadLocal<Long> BEGIN_TIME = new ThreadLocal<Long>();

	public static void begin()
	{
		BEGIN_TIME.set(Long.valueOf(System.currentTimeMillis()));
	}

	public static long end()
	{
		Long beginTime = BEGIN_TIME.get();

		if (null == beginTime)
		{
			return -1;
		}

		return System.currentTimeMillis() - beginTime.longValue();
	}

}
